{% extends "layout.html" %}

{% block title %}Chargement des CDR{% endblock %}

{% block content %}
    <div class="loading" style="display: none">
        Veuillez patienter ...
        <img src="templates/default/img/loading.gif" alt="Chargement">
    </div>
    <fieldset>
        <legend>Chargement CDR</legend>
    </fieldset>

    <form enctype="multipart/form-data" action="chargement-cdr" method="post" class="cdr">
        Type du CDR : 
        <select name="type-cdr">
            {% for  key, operator in cdr_conf %}
                {% if session.niveauAuth in operator.auth %}
                    <option value="{{ key }}">{{ operator.name }}</option>
                {% endif %}
            {% endfor %}
        </select>
        <br/>
        Sélection du CDR : <input type="file" name="monfichier" />
        <input type="submit" class="btn btn btn-primary" value="Envoyer le CDR"/>
    </form>

    <form method="post" action="import-cdr" class="cdr">
        <fieldset>
            <legend>Importer en base </legend>
            Type du CDR : 
            <select name="import-cdr">
                {% for key, operator in cdr_conf %}
                    {% if session.niveauAuth in operator.auth %}
                        <option value="{{ key }}">{{ operator.name }}</option>
                    {% endif %}
                {% endfor %}
            </select>
            <br/>
            <input class="btn btn btn-primary" type="submit" value="Importer " />
        </fieldset>
    </form>
    <script type="text/javascript">
        $("form.cdr").submit(function(event) {
            $('div.alert').remove();
            $('div.loading').show();
        });
    </script>
{% endblock %}

